.NET Framework Class Library |
ConcurrentDictionary<(Of <(TKey, TValue>)>)..::.TryRemove Method |
ConcurrentDictionary<(Of <(TKey, TValue>)>) Class See Also Send Feedback |
Attempts to remove and return the the value with the specified key from the
ConcurrentDictionary<(Of <(TKey, TValue>)>).
Namespace:
System.Collections.Concurrent
Assembly:
System.Threading (in System.Threading.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Function TryRemove ( _ key As TKey, _ <OutAttribute> ByRef value As TValue _ ) As Boolean |
C# |
---|
public bool TryRemove( TKey key, out TValue value ) |
Parameters
- key
- Type: TKey
The key of the element to remove and return.
- value
- Type:
TValue
%
When this method returns, value contains the object removed from the ConcurrentDictionary<(Of <(TKey, TValue>)>) or the default value of TValue if the operation failed.
Return Value
true if an object was removed successfully; otherwise, false.Exceptions
Exception | Condition |
---|---|
System..::.ArgumentNullException | key is a null reference (Nothing in Visual Basic). |